package com.vietnam.power.persitence;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the allow_access_dictionary database table.
 * 
 */
@Entity
@Table(name="allow_access_dictionary")
public class AllowAccessDictionary implements Serializable {
	private static final long serialVersionUID = 1L;
	private int id;
	private Date createdDate;
	private String description;
	private String name;
	private List<MenuAccessRight> menuAccessRights;

	public AllowAccessDictionary() {
	}


	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}


	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="created_date")
	public Date getCreatedDate() {
		return this.createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}


	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}


	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}


	//bi-directional many-to-one association to MenuAccessRight
	@OneToMany(mappedBy="allowAccessDictionary")
	public List<MenuAccessRight> getMenuAccessRights() {
		return this.menuAccessRights;
	}

	public void setMenuAccessRights(List<MenuAccessRight> menuAccessRights) {
		this.menuAccessRights = menuAccessRights;
	}

	public MenuAccessRight addMenuAccessRight(MenuAccessRight menuAccessRight) {
		getMenuAccessRights().add(menuAccessRight);
		menuAccessRight.setAllowAccessDictionary(this);

		return menuAccessRight;
	}

	public MenuAccessRight removeMenuAccessRight(MenuAccessRight menuAccessRight) {
		getMenuAccessRights().remove(menuAccessRight);
		menuAccessRight.setAllowAccessDictionary(null);

		return menuAccessRight;
	}

}